import 'package:get/get.dart';
import 'package:search_people/entrance/route/routes.dart';
import 'package:search_people/global/user/logic.dart';
import 'package:search_people/utils/dialog_util.dart';
import 'package:share_plus/share_plus.dart';

import 'index.dart';
import 'models/me.dart';

class MeController extends GetxController {
  MeController();

  final state = MeState();

  /// 在 widget 内存中分配后立即调用。
  @override
  void onInit() {
    super.onInit();

    state.list = [
      // MeModel(
      //   name: '用户协议',
      //   icon: 'icon_privary.png'.imgPathMe,
      //   content: '',
      //   onTap: () {
      //     Get.to(() => H5Page('用户协议',
      //         UrlPath.userAgreementUrl));
      //   },
      // ),
      MeModel(
        name: '我的关注',
        icon: 'assets/images/me/icon_manual.png',
        content: '',
        onTap: () {
          Get.toNamed(RouterPath.followPage);
        },
      ),
      MeModel(
        name: '浏览历史',
        icon: 'assets/images/me/icon_about.png',
        content: '',
        onTap: () {
          Share.share('罗云峰 https://example.com', subject: '快来看吧！');
        },
      ),

      MeModel(
        name: '我的消息',
        icon: 'assets/images/me/icon_manual.png',
        onTap: () {},
      ),

      MeModel(
        name: '设置',
        icon: 'assets/images/me/icon_about.png',
        onTap: () {
          Get.toNamed(RouterPath.setup);
        },
      ),
    ];
  }

  /// 在 onInit() 之后调用 1 帧。这是进入的理想场所
  @override
  void onReady() {
    super.onReady();
  }

  /// 在 [onDelete] 方法之前调用。
  @override
  void onClose() {
    super.onClose();
  }

  /// dispose 释放内存
  @override
  void dispose() {
    super.dispose();
  }
}
